<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      class Animal {
        eat = true;
        say() {
          console.log('hello');
        }
      }
      class Rabit extends Animal {}
      const r = new Rabit();
      console.log(r.eat);
      r.say();
      console.log(r);
      
      console.log(r.__proto__ === Rabit.prototype);
      console.log(Rabit.prototype.__proto__ === Animal.prototype);
      /*
        extends
        1. 复制所有父类中的属性、字段
        2. r.__proto__ => Rabit.prototype
        3. Rabit.prototype.__proto__ => Animal.prototype
      */
    </script>
  </body>
</html>
